﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AirLinq.Providers.Sql {
	public class SqlUnaryScalarOperaion : SqlExpression {
		private readonly SqlExpression _inner;
		private readonly SqlNodeType _nodeType;
		public SqlUnaryScalarOperaion(SqlExpression inner, SqlNodeType nodeType) {
			if (inner == null) {
				throw new ArgumentNullException("inner");
			}
			if (nodeType != SqlNodeType.BitNot
				&& nodeType != SqlNodeType.Positive
				&& nodeType != SqlNodeType.Negative) {
				throw new ArgumentException("operation must be unary scalar operation");
			}
			_inner = inner;
			_nodeType = _nodeType;

		}
		public SqlExpression Inner {
			get{
				return _inner;
			}
		}
		public override SqlNodeType NodeType {
			get {
				return _nodeType;
			}
		}
	}
}
